﻿using FikriKibar.Entities.Composite.UserModels;
using FikriKibar.Globalization;
using FluentValidation;

namespace FikriKibar.Common.Validation.FluentValidation.User
{
    public class UpdatePasswordRules : AbstractValidator<UpdateModel>
    {
        public UpdatePasswordRules()
        {
            RuleFor(p => p.User.OldPassword).NotEmpty().WithMessage(Resources.PasswordNotEmpty);
            RuleFor(p => p.User.Password).NotEmpty().WithMessage(Resources.PasswordNotEmpty);
            RuleFor(p => p.User.Password).Length(8, 129).WithMessage(Resources.PasswordLength);
            RuleFor(p => p.User.Password).Equal(p => p.User.ConfirmPassword).WithMessage(Resources.PasswordEqual);
        }
    }
}
